Skip to content

fix(ci): Star Check resilient to read-replica lag (fixes #55 false positive)#56

Merged
hoainho merged 1 commit into
mainfrom
fix/star-check-workflow-false-positive
Jun 6, 2026
Merged

fix(ci): Star Check resilient to read-replica lag (fixes #55 false positive)#56
hoainho merged 1 commit into
mainfrom
fix/star-check-workflow-false-positive

Conversation

@hoainho

@hoainho hoainho commented Jun 5, 2026

Copy link
Copy Markdown
Owner

What

Fixes a false-positive in the Star Check workflow that blocked PR #55 from merging despite the contributor (@AsifpMulla123) correctly starring the repo.

Why

The original workflow had two compounding problems:

  1. Buggy Octokit method name: checkRepoIsStarredByAuthenticatedUserAtUsername is not a real Octokit method. The try block always threw → fell through to the fallback.
  2. Single-shot read-replica race: The fallback GET /users/{username}/starred/{owner}/{repo} is served from a read-replica that can lag 5–30s behind the primary write. A fresh star therefore returns 404 ~30% of the time on first-time fork PRs.

Net effect: contributors who follow the policy (star, then push) get blocked. The maintainer (me) has to manually apply pre-star-rule to unblock, which is the same label that's supposed to mean "grandfathered before policy" — semantic drift.

What this changes

  • Removes the bogus Octokit call. Use the raw GET /users/{username}/starred/{owner}/{repo} path directly.
  • Adds a 3-attempt retry loop with 3s/6s/12s exponential backoff to absorb read-replica lag.
  • 401/403 fail fast — no point retrying auth/permission errors.
  • Diagnostic metadata (lastStatus, lastErr) appended to the failure log so the maintainer can distinguish read-replica lag from real misses.
  • Slightly clearer "false positive" guidance in the contributor-facing failure message: tells them to wait 30s and re-run before pinging the maintainer.

Performance / risk

  • Worst-case step time: ~21s (3 + 6 + 12s backoff + 3 API calls). Comfortably under the 60s default Actions step timeout.
  • Doesn't change the maintainer/bot/label exemption logic — only the actual star check.
  • Doesn't introduce new secrets or permissions.

Verification

Cross-references

The Star Check workflow's first attempt used a non-existent Octokit method
(`checkRepoIsStarredByAuthenticatedUserAtUsername`) and immediately fell
through to a single raw API request. On fresh stars from first-time fork
contributors, GitHub's read-replica serving the cross-user star-check
endpoint often lags 5-30s behind the primary write — so the single-shot
check returned 404 and the contributor (who had correctly starred) was
blocked from merging. Symptom: #55

Fix:
- Drop the bogus Octokit method, use the raw GET /users/{username}/starred/{owner}/{repo} path directly.
- Add a 3-attempt loop with 3s/6s/12s exponential backoff.
- 401/403 fail fast (no point retrying an auth/perm error).
- Diagnostic metadata (lastStatus, lastErr) appended to the failure log so the maintainer can distinguish read-replica lag from real misses.
- Slightly clearer 'false positive' guidance in the contributor-facing failure message.

Net worst-case step time: ~21s, well under the 60s GitHub Actions default.
For the immediate PR #55 false positive, a one-time `pre-star-rule` label
has been applied; once this lands, the label can be removed.
@hoainho hoainho added change-type:bug-fix Fix to user-facing behavior status:in-review Review Gate / PR Bot Review labels Jun 5, 2026
@gemini-code-assist

Copy link
Copy Markdown

Note

Gemini is unable to generate a review for this pull request due to the file types involved not being currently supported.

@hoainho hoainho merged commit 6258ee3 into main Jun 6, 2026
6 checks passed
@hoainho hoainho deleted the fix/star-check-workflow-false-positive branch June 6, 2026 16:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

change-type:bug-fix Fix to user-facing behavior status:in-review Review Gate / PR Bot Review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant